package com.lsm.app.aop;

import java.util.ArrayList;
import java.util.Arrays;

import javax.servlet.http.HttpSession;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.context.annotation.Configuration;

import com.fasterxml.jackson.databind.util.JSONPObject;
import com.lsm.app.constant.C;
import com.lsm.app.model.Jresult;

@Aspect
@Configuration
public class CtrlAop {
	@Pointcut("execution(* com.lsm.app.control.*.sayN*(..))")
	public void anyTransfer(){
	}
	@Around("anyTransfer()")
	public Object anyTransferAround(ProceedingJoinPoint jp){
		HttpSession session=(HttpSession) jp.getArgs()[0];
		if(null==session.getAttribute(C.SKEY_CUR_USER)){
			return new Jresult();
		}else{
			try {
				return jp.proceed(jp.getArgs());
			} catch (Throwable e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return null;
	}
}
